package com.itheima.mapper;

import com.itheima.dto.EmpDto;
import com.itheima.dto.EmpLoginDto;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 员工管理
 */
@Mapper
public interface EmpMapper {

    /*@Select("select * from emp limit #{start},#{pageSize} ")
    List<Emp> getByPage(@Param("start") Integer start, @Param("pageSize") Integer pageSize);

    @Select("select count(*) from emp")
    Long getTotal();*/

    List<Emp> getByPage(EmpDto dto);

    int deleteEmp(@Param("ids") Integer[] ids);

    int insertEmp(Emp emp);
    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp findByUsernameAndPassword(EmpLoginDto dto);

    @Delete("delete from emp where dept_id=#{id}")
    int deleteByDeptId(Integer id);
}
